﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;



namespace Gnosis.Alexandria.Views
{
    public class ViewControlBase
        : UserControl, IViewOld
    {
        public IControllerOld Controller
        {
            get;
            set;
        }

        protected void SetControlAnchorAll(Control control)
        {
            control.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
        }

        protected virtual void HandleConceal()
        {
            Hide();
        }

        protected virtual void HandleDisplay()
        {
            Show();
        }

        protected virtual void HandleRemove()
        {
        }

        protected virtual void HandleMessage(IMessageOld message)
        {
        }

        public void Conceal()
        {
            HandleConceal();
        }

        public void Display()
        {
        }

        public void Remove()
        {
            HandleRemove();
        }

        public void Send(IMessageOld message)
        {
            HandleMessage(message);
        }

        public void Send(string type)
        {
            HandleMessage(new Message(type));
        }

        public void Send(string type, object body)
        {
            HandleMessage(new Message(type, body));
        }
    }
}
